
define(['ionic', 'controllers'], function () {
    angular.module('U9Mobile.controllers')
        .controller('InsetPageCtrl', ['$scope', '$stateParams', 'AppConstants', 
            function ($scope, $stateParams, AppConstants) {
                $scope.data = {
                    title: '',
                    url: ''
                };

                $scope.$on('$ionicView.afterEnter', init);

                function init() {
                    var pageId = $stateParams.pageId,
                        url;
                    if (pageId === 'u9news') {
                        url = AppConstants.NEWS_URL;
                        $scope.data.title = 'U9资讯';
                    } else if (pageId === 'feedback') {
                        url = AppConstants.FEEDBACK_URL;
                        $scope.data.title = '意见反馈';
                    } else {
                        return;
                    }
                    $scope.data.url = url.format({
                        access_token: AppConstants.U9HUB_TOKEN
                    });
                }
            }
        ]);
});